<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2900：好玩的数字游戏</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">好玩的数字游戏</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">好玩的数字游戏</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                好玩的数字游戏                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：512MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div style="text-indent: 21pt"><span style="font-size: 12pt">TK</span><span style="font-size: 12pt">在虐题的同时，也喜欢玩游戏。</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">现在，有这样的一个游戏，规则是这样的：</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">先随机给出一个数字</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">，然后你在操场上把</span><span style="font-size: 12pt">1</span><span style="font-size: 12pt">到</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">的所有数字写成一排，就像这样：</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">123456789101112131415&hellip;.</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">接着你在每个数字前面添上加减号，每逢排在奇数位上的数字，就写上加号；每逢排在偶数位上的数字，就写上减号。恩</span><span style="font-size: 12pt">&hellip;</span><span style="font-size: 12pt">最后你得到一个超级长的式子。并且可以算出这个式子的结果。</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">TK</span><span style="font-size: 12pt">觉得这个游戏很有意思，于是他没日没夜地玩啊玩啊玩啊</span><span style="font-size: 12pt">&hellip;</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">或许你觉得这个游戏没有意思</span><span style="font-size: 12pt">&hellip;</span><span style="font-size: 12pt">恩</span><span style="font-size: 12pt">&hellip;</span><span style="font-size: 12pt">但是，如果你是</span><span style="font-size: 12pt">TK</span><span style="font-size: 12pt">，对于给定的</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">，你能够算出来最后的结果应该是多少么？</span></div></p><hr/><h3>输入格式</h3><p><div style="text-indent: 21pt"><span style="font-size: 12pt">多组数据。每个测试点的数据组数不超过</span><span style="font-size: 12pt">1000</span><span style="font-size: 12pt">组。</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">每一行仅一个正整数</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">。保证没有多余的什么奇怪的字符。</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">每个测试点的数据最后一行一定是数字</span><span style="font-size: 12pt">0</span><span style="font-size: 12pt">。代表这个测试点的结束。</span></div></p><hr/><h3>输出格式</h3><p><div>&nbsp;</div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">对于每组数据，输出相应的结果。</span></div></p><hr/><h3>样例输入</h3><pre>12
0
</pre><hr/><h3>样例输出</h3><pre>5</pre><hr/><h3>提示</h3><p><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><b style="mso-bidi-font-weight: normal"><span style="font-size: 15pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">【样例说明】</span></b><b style="mso-bidi-font-weight: normal"><span lang="EN-US" style="font-size: 15pt; mso-fareast-font-family: 华文细黑"><o:p></o:p></span></b></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Calibri">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">对于</span></font><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">12</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">这个数字：</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 20.25pt"><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">写成一行就是：</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">123456789101112<o:p></o:p></font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 20.25pt"><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">那么，形成的表达式就是：</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">+1-2+3-4+5-6+7-8+9-1+0-1+1-1+2=5.<o:p></o:p></font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><b style="mso-bidi-font-weight: normal"><span style="font-size: 15pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">【数据范围】</span></b><b style="mso-bidi-font-weight: normal"><span lang="EN-US" style="font-size: 15pt; mso-fareast-font-family: 华文细黑"><o:p></o:p></span></b></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Calibri">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">对于</span></font><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">10%</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">的数据：保证第一行是数字</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">100</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">，第二行是</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">0.<o:p></o:p></font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><span style="mso-tab-count: 1"><font face="Calibri">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">对于</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">20%</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">的数据：保证数据组数不超过</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">10</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">，</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">N</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">不超过</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">10^5<o:p></o:p></font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><span style="mso-tab-count: 1"><font face="Calibri">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">对于</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">50%</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">的数据：保证数据组数不超过</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">20</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">，</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">N</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">不超过</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">10^10<o:p></o:p></font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><span style="mso-tab-count: 1"><font face="Calibri">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">对于</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">100%</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">的数据：保证数据组数不超过</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">100</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">，</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">N</font></span><span style="font-size: 12pt; font-family: 华文细黑; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri">不超过</span><span lang="EN-US" style="font-size: 12pt; mso-fareast-font-family: 华文细黑"><font face="Calibri">10^15<o:p></o:p></font></span></p>
<p></p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2900" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2900" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>